<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = {
            name:"zhang",
            age:"18",
            number:"2333",
            // 函数可以作为对象的方法
            sayName:function(){
                console.log(this.name);
            },
            sayAge:()=>{
                console.log(this.age);
            },
            sayNumber(){
                console.log(this.number);
            }
        }
        // 在方法中，谁执行方法，this就指向谁
        obj.sayName();
        obj.sayAge();
        obj.sayNumber();

    </script>
</body>
</html>